<template>
  <div class="uploadList">
    <el-table :data="tableList" stripe border class="user-table" :height="tableHeight" style="width: 100%;" v-loading="loading">
      <el-table-column fixed type="index" label="序号" sortable min-width="30"></el-table-column>
      <el-table-column prop="orderNums" label="订单号" sortable min-width="120"></el-table-column>
      <el-table-column prop="taskCode" label="任务自编号" sortable min-width="120"></el-table-column>
      <el-table-column prop="supplierName.name" label="供应商" sortable min-width="100" > </el-table-column>
      <el-table-column prop="cgPersonName" label="采购人员" sortable width="100"></el-table-column>
      <el-table-column prop="totals" label="总金额" sortable width="100"></el-table-column>
      <el-table-column prop="isStart" label="启动" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isStart ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isStockUp" label="备货" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isStockUp ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isCheckUp" label="备货过程是否检查" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isCheckUp ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isDeliver" label="发货" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isDeliver ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isArrive" label="到货" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isArrive ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="isPay" label="货款已结" width="40"  align="center">
        <template slot-scope="scope">
          <span v-if="scope.row.isPay ===1" class='el-icon-circle-check  cl-success fn-size18 '></span>
        </template>
      </el-table-column>
      <el-table-column prop="cgPersonName" label="采购人员" sortable width="100" > </el-table-column>
      <el-table-column prop="kfPersonName" label="库房人员" sortable  width="100"></el-table-column>
      <el-table-column prop="startTime" label="启动时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="stockUpTime" label="备货时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="deliverTime" label="发货时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="arriveAddTime" label="到货时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="payTime" label="付款时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="receiveInvoiceTime" label="开票日期" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="taskFinishTime" label="任务完成时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column prop="creatorName" label="创建者" sortable  width="100"></el-table-column>
      <el-table-column prop="createTime" label="创建时间" sortable width="100" :formatter="timeFormatter1"></el-table-column>
      <el-table-column fixed="right" label="操作" align="right" width="120">
        <template slot-scope="scope">
          <slot  :row="scope.row"></slot>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pagination.currentPage" :page-sizes="[10, 15,20, 25,30,50, 100]" :page-size="pagination.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagination.total"></el-pagination>
  </div>
</template>
<script>
import purchaseApi from 'plugins/axios/purchaseApi.js';
export default {
  name: 'tableList29',
  props:{
    postData:{
      type:Object
    }
  },
  data (){
    return {
      loading:false,
      tableList:[],
      pagination:{/**分页参数 */
        currentPage:1,
        pageSize:10,
        total:0
      },
    }
  },
  watch:{
    
  },
  created(){},
  computed:{
    tableHeight(){
      return this.$store.state.clientHeight-184;
    }
  },
  methods:{
    /**时间格式化 */
    timeFormatter1(row, column, cellValue, index){
      return cellValue?this.timestampToTime(cellValue,'mm-dd hh:mm'):'';
    },
    get29TableList(){
      let self = this;
      self.loading = true;
      let obj = {
        currentPage:self.pagination.currentPage,
        pageSize:self.pagination.pageSize,
        orderNums:self.postData.orderNums?self.postData.orderNums:null,
        supplier:self.postData.supplier?self.postData.supplier:null,
        taskCode:self.postData.taskCode?self.postData.taskCode:null,
        state:self.postData.state,
        isArrive:self.postData.state==='1'?null:self.postData.isArrive,
        isPay:self.postData.state==='1'?null:self.postData.isPay
      }
      purchaseApi.cgTaskList(obj).then(res=>{
        self.loading = false;
        self.tableList= res.content.records;
        self.pagination.total =res.content.total;
      },error=>{
        self.loading = false;
      })
    },
    handleSizeChange(size){/**切换分页条数 */
      this.pagination.pageSize=size;
      this.pagination.currentPage=1;
      this.get29TableList();
    },
    handleCurrentChange(current){/**切换分页页数 */
      this.pagination.currentPage=current;
      this.get29TableList();
    }
  }
}
</script>
<style lang="stylus" scoped>

</style>